﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Shapes;
using DataModel;
using P_PersonalDetails.Service.UpdateComplete;
namespace P_PersonalDetails
{
    public partial class PersonalDetailsPage : UserControl
    {
        public PersonalDetailsPage()
        {
            InitializeComponent();
            SRV.SaveCompleteCompleted += new EventHandler<System.ComponentModel.AsyncCompletedEventArgs>(SRV_SaveCompleteCompleted);
        }

        void SRV_SaveCompleteCompleted(object sender, System.ComponentModel.AsyncCompletedEventArgs e)
        {
            SSCCMembershipContent.NavigateCommand.NavigateTo("U_UserHome.UserHomePage");
        }
        public void SetMember(int MemberID)
        {
            this.DataContext = MemberID;
            //MessageBox.Show(MemberID.ToString());
        }

        private void UserControl_Loaded(object sender, RoutedEventArgs e)
        {

        }


        bool Confirmed = false;
        private void Done(object sender, RoutedEventArgs e)
        {
            if (Confirmed)
            {
                SRV.SaveCompleteAsync((int)DataContext);
            }
            else
            {
                SSCCMembershipContent.NavigateCommand.NavigateTo("U_UserHome.UserHomePage");
            }
        }

        private void Confirm(object sender, RoutedEventArgs e)
        {
            Confirmed = true;
            btnDone.Content = "Confirm and return";
        }

        private void Unconfirm(object sender, RoutedEventArgs e)
        {
            Confirmed = false;
            btnDone.Content = "Return without confirming";
        }

        UpdateDetailsCompleteClient SRV = ServiceConfig.NewUpdateDetailsCompleteClient();
    }
}
